Type safety in the JVM: some problems in Java 2 SDK 1.2 and proposed solutions
نویسندگان
چکیده
class LocalClassLoader extends ClassLoader { private String directory; public LocalClassLoader (String dir) { directory = dir; } protected Class loadClassFromFile(String name) throws ClassNotFoundException, FileNotFoundException { File target = new File(directory + name.replace(’.’, ’/’) + ".class"); if (! target.exists()) throw new FileNotFoundException(); long bytecount = target.length(); byte[] buffer = new byte[(int) bytecount]; try { FileInputStream f = new FileInputStream(target); int readCount = f.read(buffer); f.close(); Class c = defineClass(name, buffer, 0, (int) bytecount); System.out.println ("[Loaded " + name + " from " + target + " ("+ bytecount + " bytes)]"); return c; } catch (Exception e) { System.out.println("Aborting read: " + e.toString() + " in LocalClassLoader."); throw new ClassNotFoundException(); }; } } Figure A3. Code for class LocalClassLoader.
منابع مشابه
Framework for Prioritizing Solutions in Overcoming Data Quality Problems Using Analytic Hierarchy Process (AHP)
The Central Statistics Agency (BPS) is a government institution that has the authority to carry out statistical activities in the form of censuses and surveys, to produce statistical data needed by the government, the private sector and the general public, as a reference in planning, monitoring, and evaluation of development results. Therefore, providing quality statistical data is very decisiv...
متن کاملOS-Caused Large JVM Pauses: Investigations and Solutions
For customer-facing Java applications (e.g., online gaming and online chatting), ensuring low latencies is not just a preferred feature, but a must-have feature. Given the popularity and powerfulness of Java, a significant portion of today's backend services are implemented in Java. JVM (Java Virtual Machine) manages a heap space to hold application objects. The heap space can be frequently GC-...
متن کاملReasoning about safety properties in a JVM-like environment
Type-based protection mechanisms in a JVM-like environment must be administrated by the code consumer at the bytecode level. Unfortunately, formulating a sound static type system for the full JVM bytecode language can be a daunting task. It is therefore counter-productive for the designer of a bytecode-level type system to address the full complexity of the VM environment in the early stage of ...
متن کاملSuperinstructions and Replication in the Cacao JVM interpreter
Dynamic superinstructions and replication can provide large speedups over plain interpretation. In a JVM implementation we have to overcome two problems to realize the full potential of these optimizations: the conflict between superinstructions and the quickening optimization; and the non-relocatability of JVM instructions that can throw exceptions. In this paper, we present solutions for thes...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Concurrency and Computation: Practice and Experience
دوره 13 شماره
صفحات -
تاریخ انتشار 2001